package com.tbit.factory;

import com.tbit.uqbike.constant.enums.SynchronousConfigEnum;
import com.tbit.uqbike.service.baseAbstract.SynchronousService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 同步配置工厂(工厂+策略)
 * @author <a href="mailto:liu.haoxiang@tbit.com.cn">BUGXiang</a>
 * @version 1.0
 * @since 2025-2-19
 */
@AllArgsConstructor
@Component
public class SynchronousFactory {

    private final Map<String, SynchronousService> map;

    /**
     * 根据具体配置获取对应实现类
     * @param syncConfig 配置枚举
     * @return 具体配置实现类
     */
    public SynchronousService getService(SynchronousConfigEnum syncConfig){
        return map.get(syncConfig.getClassName());
    }
}
